package com.huai.demo_test1.singletionsecond.enumsingleton;/** * 枚举类单例 * 天然的序列化机制能强有力的保证不会出现多次实例化的情况 * 单例模式的最佳实践 * @author huaixiaohuan */public enum EnumInstance {    INSTANCE;    private Object data;    public Object getData() {        return data;    }    public void setData(Object data) {        this.data = data;    }    public static EnumInstance getInstance(){        return INSTANCE;    }}